
import PyQt5
from PyQt5.QtCore import QMetaObject, QThread

import cache
from action import loginAction
from app import App
from cache import Cache


class LoginHandler(QThread):
    def __init__(self,head,msgBody):
        super().__init__()
        self.head = head
        self.msgBody = msgBody

    def __del__(self):
        self.wait()

    def run(self):
        if self.head.result == 0:
            QMetaObject.invokeMethod(App.getInstance(), 'createMain')


def process(head,msgBody):
    if head.result == 0:
        #app = App.getInstance()
        app = Cache.app
        print(app)
        print(id(app))

        QMetaObject.invokeMethod(app, 'createMain', PyQt5.QtCore.Qt.QueuedConnection)

        '''
        app = App()
        print(id(app))
        app.createMainThread.start()
        '''


